1. Related Patents
The invention disclosed herein is related to the invention described in U.S. Pat. No. 5,315,703, entitled "OBJECT-ORIENTED NOTIFICATION FRAMEWORK SYSTEM", by David R. Anderson, et al., assigned to the same assignee as the invention disclosed herein and incorporated herein by reference.
The invention disclosed herein is related to the invention described in U.S. Pat. No. 5,519,867, entitled "OBJECT-ORIENTED MULTITASKING SYSTEM", by Eugenie L. Bolton, et al., assigned to the same assignee as the invention disclosed herein and incorporated herein by reference.
2. Discussion of the Background
A program in a procedural language such as Fortran or Basic, is a list of instructions that tell the computer to perform an operation. Large procedural programs are broken into subroutines with smaller lists of instructions. In a procedural language program, the emphasis is on performing operations, such as to display a text or read a disk. Variables in the procedural instructions are assigned values when instructions are executed, those values being derived from units of data read into the computer. The variables and the data are exposed to and can be manipulated by instructions in any part of the procedural program.
A program in an object oriented language such as C++ or Smailtalk, combines data and the instructions or methods that operate on the data into a single unit, the object. Typically, the programmer can limit the methods within the object to be the only route to manipulate the data contained in that object. This is the principle of encapsulation. In an object oriented program, the emphasis is on the entities that perform, represented by objects, not on the performance of operations, as in a procedural program.
The methods and variables for a particular object are defined by a class template. All objects which are instances of a given class are identical in form and behavior, but contain different data in their variables. Classes are organized in a tree structure representing the relationships among a set of classes. Classes higher in the hierarchy are superclasses. Classes lower in the hierarchy are subclasses. They can make use of the methods and variables defined in all classes above them on their branch of the class hierarchy, through the principle of inheritance. Subclasses inherit the methods and variables from their superclasses.
One object can signal another object to perform the methods contained in the receiving object, by sending a message. The message consists of the name of the receiver, the method it is to carry out, and any parameters the method may require to fulfill the request.
The variables within a method in an object may be assigned values by reference. A reference provides an alias for a variable. Instead of a value being passed to the function, a reference is passed to the original variable in the calling program. The programmer can have the function access the actual variables in the calling program. Another way to pass arguments to functions is to use pointers. A pointer variable, or simply a pointer, is a variable that holds an address value to data or to an object. Passing a pointer as an argument to a function is somewhat similar to passing a reference. They both permit the variable in the calling program to be modified by the function. However, whereas a reference is an alias for the original variable, a pointer is the address of the variable. This can be useful in accessing arrays of data. Pointers can point to objects as well as to simple data types. For example, an array of pointers allows easy access to a group of objects, and is more flexible than placing the objects themselves in an array. For instance, a group of objects can be sorted by sorting an array of pointers to the objects, instead of sorting the objects themselves.
The object oriented program written in source code by the programmer in the C++ or Smalltalk language, is compiled with a C++ or Smalltalk compiler. Then the compiled program is executed at runtime. During the running of the program, memory space can be unnecessarily occupied by objects that are no longer used. When an object is instantiated from a class that includes a pointer to a target class, an instance of the target class must also be instantiated, unless it already exists in the system memory. In early object oriented environments available in the prior art, when the referencing object was later destroyed, there was no way provided by the object oriented environment to also remove the target object. Unused objects would then accumulate in the system memory reducing the available free memory space. Later prior object oriented environments provided an automatic mechanism to reclaim memory space, by associating an up-down counter with each object that is the target of a pointer reference from another object. The counter is incremented with each additional referencing object. The counter is decremented when the referencing object is destroyed. When the counter returns to zero the target object is destroyed, thereby freeing the portion of the memory that it occupied.
Frequently, object oriented programs will load other programs, libraries, or other modules that contain objects that do not have the up-down counter destruction feature. The prior art does not have a way to automatically clear such objects from the memory after they are no longer used. What is needed is a mechanism to monitor objects during their lifetime in the memory, to manage those objects that do not have an up-down counter destruction feature.
The following references give some additional background on object oriented programming principles:
Booch, Grady. Object Oriented Design and Applications. 2d ed. Redwood City, Calif.: Benjamin/Cummings, 1994. PA1 Budd, Timothy. Introduction to Object-Oriented Programming. Reading, Mass.: Addison-Wesley, 1991. PA1 Goldstein, Neil, and Jeff Alger. Developing Object-Oriented Software for the Macintosh. Reading, Mass.: Addison-Wesley, 1992. PA1 Meyer, Bertrand. Object-Oriented Software Construction. Englewood Cliffs, N.J.: Prentice Hall, 1988. PA1 Taylor, David A. Object-Oriented Information Systems: Planning and Implementation. Reading, Mass.: Addison-Wesley, 1992. PA1 Wirfs-Brock, Rebecca, et al. Designing Object-Oriented Software. Englewood Cliffs, N.J.: Prentice Hall, 1990. PA1 ISO/ANSI C++ Draft Standard, April 1995, American National Standards Institute.